using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;

public class PlayerAnimTrigger : MonoBehaviour
{
    private Player player => GetComponentInParent<Player>();

    private void AnimationTrigger()
    {
        player.AnimationTrigger();
    }

    private void AttackTrigger()        
    {
        Collider2D[] colidders = Physics2D.OverlapCircleAll(player.attackCheckPos.position, player.attackCheckRadius);

        foreach (var hit in colidders)
        {
            if (hit.GetComponent<Enemy>() != null)
            {
                CharacterStats _target = hit.GetComponent<CharacterStats>();

                player.stats.DoDamage(_target);

                PlayerManager.Instance.player.GetComponent<PlayerStats>().GetEnergy();
                Debug.Log("Get Energy");

                //hit.GetComponent<Enemy>().DamageEffect();
                //hit.GetComponent<CharacterStats>().TakeDamaged(player.stats.damage.GetValue());

                //ItemData_Euqipment weaponData = Inventory.instance.GetEquipment(EquipmentType.Weappon);

                //if (weaponData != null)
                //weaponData.Effect(_target.transform);
            }
        }
    }
}
